package com.eagledata.project.business.serviceLog.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.eagledata.common.utils.StringUtil;
import com.eagledata.project.business.serviceLog.mapper.ServiceLogMapper;
import com.eagledata.project.business.serviceLog.domain.ServiceLog;
import com.eagledata.project.business.serviceLog.service.IServiceLogService;

/**
 * 服务日志 服务层实现
 * 
 * @author eagledata
 * @date 2018-09-09
 */
@Service
public class ServiceLogServiceImpl implements IServiceLogService 
{
	@Autowired
	private ServiceLogMapper serviceLogMapper;
	
	/**
     * 查询服务日志信息
     * 
     * @param id 服务日志ID
     * @return 服务日志信息
     */
	 @Override
	public ServiceLog selectServiceLogById(Long id) {
	    return serviceLogMapper.selectServiceLogById(id);
	}
	
	/**
     * 查询服务日志列表
     * 
     * @param serviceLog 服务日志信息
     * @return 服务日志集合
     */
	 @Override
	public List<ServiceLog> selectServiceLogList(ServiceLog serviceLog) {
	    return serviceLogMapper.selectServiceLogList(serviceLog);
	}
	
    /**
     * 新增服务日志
     * 
     * @param serviceLog 服务日志信息
     * @return 结果
     */
	 @Override
	public int insertServiceLog(ServiceLog serviceLog) {
	    return serviceLogMapper.insertServiceLog(serviceLog);
	}
	
	/**
     * 修改服务日志
     * 
     * @param serviceLog 服务日志信息
     * @return 结果
     */
	 @Override
	public int updateServiceLog(ServiceLog serviceLog) {
	    return serviceLogMapper.updateServiceLog(serviceLog);
	}
	
	/**
     * 保存服务日志
     * 
     * @param serviceLog 服务日志信息
     * @return 结果
     */
	 @Override
	public int saveServiceLog(ServiceLog serviceLog) {
	    Long id = serviceLog.getId();
		int rows = 0;
		if (StringUtil.isNotNull(id)) {
		    rows = serviceLogMapper.updateServiceLog(serviceLog);
		} else {
		    rows = serviceLogMapper.insertServiceLog(serviceLog);
		}
		return rows;
	}
	
	/**
     * 删除服务日志信息
     * 
     * @param id 服务日志ID
     * @return 结果
     */
	 @Override
	public int deleteServiceLogById(Long id) {
	    return serviceLogMapper.deleteServiceLogById(id);
	}
	
	/**
     * 批量删除服务日志对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	 @Override
	public int batchDeleteServiceLog(Long[] ids) {
		return serviceLogMapper.batchDeleteServiceLog(ids);
	}
	
}
